<?php
	header("Content-type:text/html;charset=utf-8");
	
	$name = $_POST["userName"];
	$pwd = $_POST["userPwd"];
 
	// 1.创建链接  
	$conn = mysql_connect("localhost","root","root");

	// 2.选择库名
	mysql_select_db("nanzhijiamu");
  
	// 3.操作
	$result = mysql_query("select * from userMsg where userName='$name'",$conn);
  
	// var_dump("select * from userMsg where userName='$name' And userPwd='$pwd'");
  
	if(mysql_num_rows($result) == 1){
		echo 1, die;
	}else{
		echo 0;
	$account = mysql_query("insert into userMsg  (userName, userPwd) values ('$name', '$pwd')",$conn);
	if(mysql_num_rows($account) == 1){
	    echo 1;
	}else{
	    echo 0;
		}
	}
	  var_dump("insert into userMsg  (userName, userPwd) values ('$name', '$pwd')"	);
	  // 0 注册成功
	  // 1 是已注册

	// 4.关闭数据库
	mysql_close($conn);
?>